<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>RBAC-CLI - 添加用户</title>
    <meta name="keywords" content="RBAC,CLI,权限,权限脚手架">
    <meta name="description" content="一款基于Spring+SpringMVC+Mybatis+Shiro的一个权限脚手架，用户可在此基础上很方便的进行二次开发！">
    <!--浏览器默认内核指定-->
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <!--指定IE8浏览器去模拟某个特定版本的IE浏览器的渲染方式-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <!--设置移动端自适应-->
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--禁止搜索引擎转码-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--在浏览器收藏夹中显示的图标-->
    <link rel="Bookmark" href="/resources/favicon.ico">
    <!--网页标题小图标-->
    <link rel="Shortcut Icon" href="/resources/favicon.ico"/>
    <!--css引入-->
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/resources/static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/resources/lib/zTree_v3/css/zTreeStyle/zTreeStyle.css">
    <style>
        .line{border-top: 0;}
    </style>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/resources/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/resources/lib/respond.min.js"></script>
    <![endif]-->
    <!--[if IE 6]>
    <script type="text/javascript" src="/resources/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
</head>
<body>
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="userForm">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="用户名" autocomplete="off" name="username">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>真实姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="真实姓名" autocomplete="off" name="reallyName">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="邮箱" autocomplete="off" name="email">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="手机" autocomplete="off" name="mobile">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input type="radio" id="type-1" value="0" name="status" checked>
                    <label for="type-1">正常</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="type-2" value="1" name="status" >
                    <label for="type-2">停用</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="type-3" value="2" name="status">
                    <label for="type-3">删除</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <#list sysRoleList as item>
                    <div class="check-box">
                        <input type="checkbox" name="roleIds[]" value="${item.id}" ${(item.isSelf==true)?string('checked','')}> ${item.name}
                    </div>
                </#list>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/resources/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/resources/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/resources/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/resources/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/resources/lib/zTree_v3/js/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="/resources/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/resources/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/resources/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function () {
        // 单选样式
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        var loadIndex;
        $("#userForm").validate({
            rules: {
                username: {
                    required: true
                },
                reallyName: {
                    required: true
                },
                email: {
                    required: true,
                    email: true
                },
                mobile: {
                    required: true
                },
                status: {
                    required: true
                },
                'roleIds[]': {
                    required: true
                }
            },
            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    url: "/sys/user/add",
                    type: "post",
                    dataType: "json",
                    data: {},
                    beforeSend: function () {
                        loadIndex = layer.load(0, {shade: 0.1});
                    },
                    complete: function () {
                        layer.close(loadIndex);
                    },
                    success: function (data) {
                        if (data.status == 0) {
                            layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        } else {
                            layer.msg(data.msg, {icon: 5, time: 1000});
                        }
                    },
                    error: function () {
                        layer.msg('服务器错误', {icon: 5, time: 1000});
                    }
                });
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>